﻿using System;
using System.Collections;

namespace SharpTrainer.DP.Observer.Generic
{
    public abstract class Subject 
    { 
        private ArrayList observers = new ArrayList();

        public void Attach(Observer observer) 
        { 
            observers.Add(observer); 
        } 
        
        public void Detach(Observer observer) 
        { 
            observers.Remove(observer); 
        } 
        
        public void Notify() 
        { 
            foreach (Observer o in observers) 
            { 
                o.Update(); 
            } 
        }
    }
}
